﻿@using System.Configuration
@*框架列表页面模版*@
@{
    string v = ConfigurationManager.AppSettings["version"];
}

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>

    <meta name="description" content="overview &amp; stats" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

    <!-- bootstrap & fontawesome -->
    <link rel="stylesheet" href="/Content/ace/assets/css/bootstrap.css" />
    <link rel="stylesheet" href="/Content/components/font-awesome/css/font-awesome.css" />

    <!-- page specific plugin styles -->
    <!-- text fonts -->
    <link rel="stylesheet" href="/Content/ace/assets/css/ace-fonts.css" />

    <!-- ace styles -->
    <link rel="stylesheet" href="/Content/ace/assets/css/ace.css" class="ace-main-stylesheet" id="main-ace-style" />

    <!--[if lte IE 9]>
        <link rel="stylesheet" href="/Content/ace/assets/css/ace-part2.css" class="ace-main-stylesheet" />
    <![endif]-->
    <link rel="stylesheet" href="/Content/ace/assets/css/ace-skins.css" />
    <link rel="stylesheet" href="/Content/ace/assets/css/ace-rtl.css" />

    <!--[if lte IE 9]>
      <link rel="stylesheet" href="/Content/ace/assets/css/ace-ie.css" />
    <![endif]-->
    <!-- inline styles related to this page -->
    <!-- ace settings handler -->
    <script src="/Content/ace/assets/js/ace-extra.js"></script>

    <!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->
    <!--[if lte IE 8]>
    <script src="/Content/components/html5shiv/dist/html5shiv.min.js"></script>
    <script src="/Content/components/respond/dest/respond.min.js"></script>
    <![endif]-->
    <!-- basic scripts -->
    <!--[if !IE]> -->
    <script src="/Content/components/jquery.1x/dist/jquery.js"></script>
    @*<script src="/Content/components/jquery/dist/jquery.js"></script>*@
    <![endif]-->
    <!--[if IE]>
    <script src="/Content/components/jquery.1x/dist/jquery.js"></script>
    <![endif]-->
    <script src="/Content/components/bootstrap/dist/js/bootstrap.js"></script>
    <!-- ace scripts -->
    <script src="/Content/ace/assets/js/src/elements.scroller.js"></script>
    <script src="/Content/ace/assets/js/src/elements.colorpicker.js"></script>
    <script src="/Content/ace/assets/js/src/elements.fileinput.js"></script>
    <script src="/Content/ace/assets/js/src/elements.typeahead.js"></script>
    <script src="/Content/ace/assets/js/src/elements.wysiwyg.js"></script>
    <script src="/Content/ace/assets/js/src/elements.spinner.js"></script>
    <script src="/Content/ace/assets/js/src/elements.treeview.js"></script>
    <script src="/Content/ace/assets/js/src/elements.wizard.js"></script>
    <script src="/Content/ace/assets/js/src/elements.aside.js"></script>
    <script src="/Content/ace/assets/js/src/ace.js"></script>
    <script src="/Content/ace/assets/js/src/ace.basics.js"></script>
    <script src="/Content/ace/assets/js/src/ace.scrolltop.js"></script>
    <script src="/Content/ace/assets/js/src/ace.ajax-content.js"></script>
    <script src="/Content/ace/assets/js/src/ace.touch-drag.js"></script>
    <script src="/Content/ace/assets/js/src/ace.sidebar.js"></script>
    <script src="/Content/ace/assets/js/src/ace.sidebar-scroll-1.js"></script>
    <script src="/Content/ace/assets/js/src/ace.submenu-hover.js"></script>
    <script src="/Content/ace/assets/js/src/ace.widget-box.js"></script>
    <script src="/Content/ace/assets/js/src/ace.settings.js"></script>
    <script src="/Content/ace/assets/js/src/ace.settings-rtl.js"></script>
    <script src="/Content/ace/assets/js/src/ace.settings-skin.js"></script>
    <script src="/Content/ace/assets/js/src/ace.widget-on-reload.js"></script>
    <script src="/Content/ace/assets/js/src/ace.searchbox-autocomplete.js"></script>

    <script src="~/Content/components/layer/layer.js"></script>
    <script type="text/javascript">
        //关闭所有的弹出层
        function closeLayer() {
             layer.closeAll(); 
        }
        function setSize() {
            var height = $(window).height();
            var body = $(window.document.body);
            var mainContent = $(".main-content");
            var navbar = $("#navbar");
            var titleBar = $("#breadcrumbs");
            var pageContent = $(".page-content");
            var sidebar = $("#sidebar");
            body.height(height);
            mainContent.height(height - navbar.outerHeight(true));
            sidebar.height(height - navbar.outerHeight(true));
            pageContent.innerHeight(mainContent.height() - titleBar.outerHeight(true));
        }

        function reloadMainFrame() {

            var url = window.document.getElementById("mainFrame").src;
            if (url) {
                window.document.getElementById("mainFrame").contentWindow.location.reload();
            }
        }

        function setURL(openmode, url, name) {
            if (name) {
                $("ul.breadcrumb").find("li.active").remove();
                $("ul.breadcrumb").append("<li class='active'><a href=\"#\" onclick=\"reloadMainFrame()\">" + name + "</a></li>");
            }
            if (url) {
                if (openmode === "1") {//弹出窗口模式
                   
                } else if (openmode === "2") {//内页page模式
                    $.ajax({
                        type: "post",
                        dataType: "text",
                        url: url,
                        data: {},
                        success: function (text) {
                            if ($("#mainFrame")[0].src !== "") {//先去掉iframe的内容
                                $("#mainFrame")[0].src = "";
                                $("#mainFrame").hide();
                            }
                            $("#mainPage").html(text);
                        }, error: function () {

                        }
                    });
                } else {//iframe模式
                    var mainFrame = $("#mainFrame");
                   
                    mainFrame.attr({ "src": url });
                }
            }
           
        }
        $(function () {

            

            setSize();
            window.onresize = setSize;

            //用户信息点击事件
            $("ul.user-menu").on("click", "a", function () {
                
                setURL("0", $(this).attr("targetLink"));
                
            });

            //菜单点击事件
            $("ul.nav.nav-list").on("click", "a[targetLink]", function () {
                
                //设置iframe的src
                var openMode = $(this).attr("openMode") || "0";
                setURL(openMode, $(this).attr("targetLink"));

                //设置菜单位置文本
                var rootItem = $(this).parents("li[menuItem]");
                $("ul.breadcrumb").find("span").text(rootItem.find("span.menu-text").text());
                $("ul.breadcrumb").find("li.active").remove();
                
                var subItem = $(this).parents("li");
                for (var i = subItem.length-1; i >=0; i--) {
                    var el = subItem[i];
                    if (typeof ($(el).attr("menuItem")) == "undefined") {
                        var $li = $("<li class='active'>" + $(el).children("a").text() + "</li>");
                        $("ul.breadcrumb").append($li);
                    }
                }
                
               // $("ul.breadcrumb").append("<li class='active'><a href=\"#\" onclick=\"reloadMainFrame()\">" + $(this).text() + "</a></li>");

                //设置菜单的active样式
                var parentLi = $(this).parent("li");
                if (parentLi.length > 0) {
                    $("ul.nav.nav-list").find("li.active").removeClass("active");
                    parentLi.addClass("active");
                }
            });
        });


    </script>

</head>
<body class="no-skin">

    @Html.Partial("_Head")
    <div class="main-container ace-save-state" id="main-container">
       @Html.Partial("_Nav")
        
        <div class="main-content">
            <div class="main-content-inner">
                <!-- #section:basics/content.breadcrumbs -->
                <div class="breadcrumbs ace-save-state" id="breadcrumbs">
                    <ul class="breadcrumb">
                        
                       
                    </ul><!-- /.breadcrumb -->
                    
                </div>
                <div class="page-content">
                    <!-- /section:basics/content.breadcrumbs -->
                    @RenderBody()
                </div><!-- /.page-content -->
            </div>
        </div><!-- /.main-content -->
        @*@Html.Partial("_Foot")*@
    </div>

</body>
</html>
